import 'package:json_annotation/json_annotation.dart';
import 'package:lazy_food/models/recipe_model.dart';
part 'weekly_model.g.dart';

@JsonSerializable()
class WeeklyModel {
  String create_time;
  String date;
  String display_date;
  double calories;
  int id;
  String message;
  String name;
  String name_adj;
  String release_time;
  int status;
  String tag;
  int time_consuming;
  bool unlocked;
  String update_time;
  List<WeeklyItemModel> items;

  WeeklyModel(
      this.create_time,
      this.display_date,
      this.release_time,
      this.update_time,
      this.id,
      this.calories,
      this.date,
      this.message,
      this.name,
      this.name_adj,
      this.status,
      this.tag,
      this.time_consuming,
      this.unlocked,
      this.items);

  factory WeeklyModel.fromJson(Map<String, dynamic> json) =>
      _$WeeklyModelFromJson(json);

  Map<String, dynamic> toJson() => _$WeeklyModelToJson(this);
}

@JsonSerializable()
class WeeklyItemModel {
  int id;
  int index;
  String label;
  int menu_id;
  int recipe_id;
  RecipeModel recipe;

  WeeklyItemModel(
      this.index, this.label, this.menu_id, this.id, this.recipe_id, this.recipe);

  factory WeeklyItemModel.fromJson(Map<String, dynamic> json) =>
      _$WeeklyItemModelFromJson(json);

  Map<String, dynamic> toJson() => _$WeeklyItemModelToJson(this);
}
